import streamlit as st from langchain_core.prompts import ChatPromptTemplate from langchain_community.chat_models import ChatOpenAI from langchain_community.chat_models import ChatOllama
model = ChatOllama(model="llamafamily/llama3-chinese-8b-instruct") chain = prompt | model
with st.form("form"): text = st.text_area("请输入问题: ") submit = st.form_submit_button("提交") if submit: st.info(chain.invoke({"topic": text})) chain.get_graph().print_ascii()